package Json;

import com.google.gson.Gson;

/**
 * @author Ajie
 * @date 2020-12-10
 * @function todo JSON 多加字段，向下兼容。
 */
public class testJson {
    public static void main(String[] args) {

//        String js = "{\"name\" :\"zyj\",\"age\":123}";
        String js ="{\"name\" :\"zyj\",\"age\":123,\"typea\":1234}";
        Gson gson = new Gson();
        testJsonA testJsonA = gson.fromJson(js, testJsonA.class);
        System.out.println(testJsonA.toString());

    }

    class testJsonA{
        String name ;
        int age;

        @Override
        public String toString() {
            return "testJsonA{" +
                    "name='" + name + '\'' +
                    ", age=" + age +
                    '}';
        }
    }
}
